﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.utils;

namespace l1cs.server.templates
{
    public class L1SpawnTime
    {
        private static Logger _log = Logger.getLogger( typeof( L1SpawnTime ).FullName );

        private int _spawnId;
        private TimeSpan _timeStart;
        private TimeSpan _timeEnd;
        private TimePeriod _timePeriod;
        private DateTime _periodStart;
        private DateTime _periodEnd;
        private bool _isDeleteAtEndTime;

        public bool isDeleteAtEndTime()
        {
            return _isDeleteAtEndTime;
        }

        private L1SpawnTime( L1SpawnTimeBuilder builder )
        {
            _spawnId = builder._spawnId;
            _timeStart = builder._timeStart;
            _timeEnd = builder._timeEnd;
            _timePeriod = new TimePeriod( _timeStart, _timeEnd );
            _periodStart = builder._periodStart;
            _periodEnd = builder._periodEnd;
            _isDeleteAtEndTime = builder._isDeleteAtEndTime;
        }

        public int getSpawnId()
        {
            return _spawnId;
        }

        public TimeSpan getTimeStart()
        {
            return _timeStart;
        }

        public TimeSpan getTimeEnd()
        {
            return _timeEnd;
        }

        public DateTime getPeriodStart()
        {
            return _periodStart;
        }

        public DateTime getPeriodEnd()
        {
            return _periodEnd;
        }

        public class L1SpawnTimeBuilder
        {
            public int _spawnId;
            public TimeSpan _timeStart;
            public TimeSpan _timeEnd;
            public DateTime _periodStart;
            public DateTime _periodEnd;
            public bool _isDeleteAtEndTime;

            public L1SpawnTimeBuilder( int spawnId )
            {
                _spawnId = spawnId;
            }

            public L1SpawnTime build()
            {
                return new L1SpawnTime( this );
            }

            public void setTimeStart( TimeSpan timeStart )
            {
                _timeStart = timeStart;
            }

            public void setTimeEnd( TimeSpan timeEnd )
            {
                _timeEnd = timeEnd;
            }

            public void setPeriodStart( DateTime periodStart )
            {
                _periodStart = periodStart;
            }

            public void setPeriodEnd( DateTime periodEnd )
            {
                _periodEnd = periodEnd;
            }

            public void setDeleteAtEndTime( bool f )
            {
                _isDeleteAtEndTime = f;
            }
        }

        public TimePeriod getTimePeriod()
        {
            return _timePeriod;
        }
    }
}
